import loading from '@/components/xuan-loading/xuan-loading.vue'
import cLabel from "@/components/cat-label/cat-label.vue"
import fromItem from '@/components/from-item/from-item.vue'

export default {
	data() {
		return {
			Inv: 0,
		
			fileList: [], //文件
			fRecheckfileList: [], //处理过程相关资料


			width: '150rpx',
			height: '100rpx',
			shadeShow: false,
			backgroundColor: "transparent",
			themeColor: '#33CCCC',


			totalData: {
				fId: "",
				fProjectid: "",
				fProjectname: "",
				fCompanyid: "",
				fCompanyname: "",
				fCreateuserid: "",
				fCreateusername: "",
				fModifyuserid: "",
				fModifydate: null,
				fModifyusername: "",
				fCheckunit: "", //涉及单位
				fCheckunitid: "", //涉及单位id
				fCheckproject: "", //涉及项目
				fCheckprojectid: "", //涉及项目
				fGridmantype: "", //网格员类别
				fSubgridmanid: "", //指定网格员id
				fSubgridmanname: "", //指定网格员姓名
				fProblemdescription: "", //存在问题简述
				fFileurl: "", //相关现场资料
				fHasproblemdates: "", //发现问题日期
				fReportid: "", //填报人id
				fReportname: "", //填报人
				fReportdates: "", //填报日期
				fCheckresult: "", //处理结果
				fCheckfile: "", //处理过程相关资料
				fCheckdescription: "", //问题处理简述
				fGridmanid: "", //网格员id
				fGridmanname: "", //网格员姓名
				fCheckdates: "", //完成日期
				fStatus: "", //信息状态
				fIsdeleted: "",
			},


			userInfo: null,
			options: null, //上个页面传递过来的参数

			//显示隐藏
			basic: 1, //基本信息
			close: 1, //受检单位签收
			//显示隐藏

		};
	},



	onReady() {},

	onLoad(options) {
		var that = this;
		uni.getStorage({ //监督检查方式
			key: 'userInfo',
			success: function(res) {
				that.userInfo = JSON.parse(res.data);
				
			}
		});


		that.fileList = [];
		that.options = options;
		that.getDetailData(options.fid);
		// || MP-WEIXIN || H5
		// #ifdef APP-PLUS
		// this.playVideo()

		// #endif
		// #ifdef H5

		// #endif

	},
	onShow() {

	},
	components: {
		loading,
		fromItem
	},

	onUnload() {


	},

	methods: {
		submit() {
			var that = this
			this.Inv = 1

		},
		unsubmit() {
			var that = this
			this.Inv = 0
		},
ViewImage(e, url) {
			var photo=[]
			this.fileList.map(item=>{
				if(item.fFileType!='.pdf'){
					photo.push(item.url)
				}
			})
			console.log(e,url)
			uni.previewImage({
				urls: photo,
				current: url,
				loop: true,
				indicator: 'default'
			});
		},
		ViewImage1(e, url) {
					var photo=[]
					this.fRecheckfileList.map(item=>{
						if(item.fFileType!='.pdf'){
							photo.push(item.url)
						}
					})
					console.log(e,url)
					uni.previewImage({
						urls: photo,
						current: url,
						loop: true,
						indicator: 'default'
					});
				},
		//显示隐藏
		downUp(num) {
			if (num == 1) {
				this.basic = 2;
			} else {
				this.basic = 1;
			}
		},

		downUpClose(num) {
			if (num == 1) {
				this.close = 2;
			} else {
				this.close = 1;
			}
		},


		//显示隐藏
		pdfPage(name, url) {
			console.log(name, url);
			var aa = url;
			let links = encodeURIComponent(aa)
			uni.navigateTo({
				url: '/pages/apply/pdf?links=' + links + '&names=' + name,
			})
		},

		// 文件选择回调
		onChange(files) {},

		// 取消回调事件
		treeCancel1(e) {},


		getDetailData(id) {
			var that = this;
			var datas = {
				fId: id,
			}
			that.$http.getWorkonlineCommunicateByFid(datas).then(res => {
				if (res.errcode == 0) {
					that.totalData = res.data.yjQmpMsWorkonlineCommunicate;

					// 文件
					var file = res.data.fFileurllist;
					file.map((item, index) => {
						that.fileList.push({
							fId: item.fId,
							name: item.fFileName,
							fFileType:item.fFileType,
							url: item.url
						})
					})
					// 处理过程相关资料
					var Recheckfile = res.data.fCheckfilelist;
					Recheckfile.map((item, index) => {
						that.fRecheckfileList.push({
							fId: item.fId,
							fFileType:item.fFileType,
							name: item.fFileName,
							url: item.url
						})
					})
					that.page = true


				} else {
					uni.showToast({
						title: "请求失败",
						icon: 'none',
						duration: 2000
					});
				}

			}, (err) => {
				uni.showToast({
					title: "接口报错",
					icon: 'none',
					duration: 2000
				});
			})




		},

		callback() {}
	}
}
